package trinnes.oliver.unimaas.smartpentalath.intelligence;

import java.util.ArrayList;
import java.util.List;
import trinnes.oliver.unimaas.smartpentalath.control.Game;
import trinnes.oliver.unimaas.smartpentalath.intelligence.features.Feature;

/**
 * Evaluation function. Sums up the values of the added features.
 * @author Oliver Trinnes
 */
public class Evaluation
{
  public static final int INFINITY = 99999;
  private List<Feature> features;

  public Evaluation()
  {
    features = new ArrayList<Feature>();
  }

  public void addFeature(Feature feature)
  {
    features.add(feature);
  }

  public int evaluate(Game game, int move)
  {
    int evaluationValue = 0;
    for (Feature feature : features)
      evaluationValue += feature.getWeight()*feature.getValue(game, move);

    return -evaluationValue;
  }
}
